import {
  type
} from "jquery";
import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);

export default new Router({
  linkActiveClass: "active",
  routes: [{
      meta: {
        title: "掌上精选",
        // type:"/"  //验证登录的
        keepAlive: false, // 此组件不需要被缓存
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/",
      name: "homepage",
      component: () => import("@/pages/home/homepage.vue")
    },
    {
      meta: {
        title: "登录",
        keepAlive: false, // 此组件不需要被缓存
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/login",
      name: "login",
      component: () => import("@/pages/home/login.vue")
    },
    {
      meta: {
        title: "绑定手机号",
        keepAlive: false, // 此组件不需要被缓存
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/loginweixin",
      name: "/loginweixin",
      component: () => import("@/pages/home/loginweixin.vue")
    },
    {
      meta: {
        title: "首页搜索",
        // type:"/"
        keepAlive: false // 此组件不需要被缓存
      },
      path: "/myheader",
      name: "myheader",
      component: () => import("@/pages/home/myheader.vue")
    },
    {
      meta: {
        title: "我的收藏",
        // type:"/"
        keepAlive: false // 此组件要被缓存
      },
      path: "/myStar",
      name: "myStar",
      component: () => import("@/pages/mine/myStar/starRoot.vue")
    },
    {
      meta: {
        title: "邀好友送会员"
      },
      path: "/invitation",
      name: "invitation",
      component: () => import("@/pages/mine/invitation.vue")
    },
    {
      meta: {
        title: "达人分析",
        // type:"/"
        keepAlive: true // 此组件不需要被缓存
      },
      path: "/talent",
      name: "talent",
      component: () => import("@/pages/talent/talentRank.vue")
    },
    {
      meta: {
        title: "达人详情",
        // type:"/"
        keepAlive: false,
        isDetails: true,  //是否为详情页
      },
      path: "/talentdetails",
      name: "talentdetails",
      component: () =>
        import("@/pages/talent/talentDetails/talentDetailsMain.vue")
    },
    {
      meta: {
        title: "商品分析",
        keepAlive: true
        // type:"/"
      },
      path: "/goods",
      name: "goods",
      component: () => import("@/pages/goods/goodsRank.vue")
    },
    {
      meta: {
        title: "直播分析",
        // type:"/"
        keepAlive: true // 此组件需要被缓存
      },
      path: "/liveRank",
      name: "liveRank",
      component: () => import("@/pages/live/liveRank/liveRankRoot.vue")
    },
    {
      meta: {
        title: "直播大屏",
        // type:"/"
        keepAlive: false // 此组件不需要被缓存
      },
      path: "/liveBigScreen",
      name: "liveBigScreen",
      component: () => import("@/pages/live/liveBigScreen/liveBigScreen.vue")
    },
    {
      meta: {
        title: "我的",
        // type:"/"
        keepAlive: false // 此组件不需要被缓存
      },
      path: "/user",
      name: "user",
      component: () => import("@/pages/mine/user.vue")
    },
    {
      meta: {
        title: "素材",
        // type:"/"
        keepAlive: false // 此组件不需要被缓存
      },
      path: "/sucai",
      name: "sucai",
      component: () => import("@/pages/mine/sucai.vue")
    },
    // // 新的路由
    {
      meta: {
        title: "直播详情",
        isDetails: true,  //是否为详情页
      },
      path: "/LiveForDetailsMain",
      name: "LiveForDetailsMain",
      component: () =>
        import("@/pages/live/LiveDetails/LiveForDetailsMain.vue"),
      children: [{
          path: "liveDataAnalysis", //数据分析
          component: () =>
            import("@/pages/live/LiveDetails/liveDataAnalysis.vue")
        },
        {
          path: "liveGoodsAnalysis", //商品分析
          component: () =>
            import("@/pages/live/LiveDetails/liveGoodsAnalysis.vue")
        },
        {
          path: "liveAudienceAnalysis", //观众分析
          component: () =>
            import("@/pages/live/LiveDetails/liveAudienceAnalysis.vue")
        }
      ]
    },
    {
      meta: {
        title: "商品详情",
        isDetails: true,  //是否为详情页
        // keepAlive: true
      },
      path: "/goodsDetailsMain",
      name: "goodsDetailsMain",
      component: () => import("@/pages/goods/goodsDetailsMain.vue"),
      children: [{
          path: "goodsLiveDetails", //直播
          component: () =>
            import("@/pages/goods/goodsDetails/goodsLiveDetails.vue")
        },
        {
          path: "goodsVideoDetails", //视频
          component: () =>
            import("@/pages/goods/goodsDetails/goodsVideoDetails.vue")
        },
        {
          path: "goodsTalentDetails", //达人
          component: () =>
            import("@/pages/goods/goodsDetails/goodsTalentDetails.vue")
        },
        {
          path: "goodsAudienceDetails", //观众分析
          component: () =>
            import("@/pages/goods/goodsDetails/goodsAudienceDetails.vue")
        }
      ]
    },
    {
      meta: {
        title: "达人详情",
        isDetails: true,  //是否为详情页
      },
      path: "/talentDetailsMain",
      name: "talentDetailsMain",
      component: () =>
        import("@/pages/talent/talentDetails/talentDetailsMain.vue"),
      children: [{
          path: "talentLiveDetails", //直播
          component: () =>
            import("@/pages/talent/talentDetails/talentLiveDetails.vue")
        },
        {
          path: "talentVideoDetails", //视频
          component: () =>
            import("@/pages/talent/talentDetails/talentVideoDetails.vue")
        },
        // {
        //   path: "talentCommerceDetails", //带货
        //   component: () =>
        //     import("@/pages/talent/talentDetails/talentCommerceDetails.vue")
        // },
        {
          path: "talentFansDetails", //粉丝
          component: () =>
            import("@/pages/talent/talentDetails/talentFansDetails.vue")
        }
      ]
    },
    {
      meta: {
        title: "直播大屏"
      },
      path: "/liveBigScreenMain",
      name: "liveBigScreenMain",
      component: () =>
        import("@/pages/live/liveBigScreenMain/liveBigScreenMain.vue")
    },
    // 搜索历史
    {
      meta: {
        title: "掌上搜索",
        keepAlive: true, // 此组件需要被缓存
        isFirst: false //是否是从搜索记录进来
      },
      path: "/searchHistory",
      name: "searchHistory",
      component: () => import("@/pages/search/searchHistory.vue")
    },
    // 搜索
    {
      meta: {
        title: "掌上搜索"
      },
      path: "/searchIndex",
      name: "searchIndex",
      component: () => import("@/pages/search/searchIndex.vue")
    },
    // 获取会员
    {
      meta: {
        title: "领取会员",
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/getMember",
      name: "getMember",
      component: () => import("@/pages/other/getMember.vue")
    },
    // 用户服务协议
    {
      meta: {
        title: "用户隐私政策",
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/privacyClause",
      name: "privacyClause",
      component: () => import("@/pages/other/privacyClause.vue")
    },
    {
      meta: {
        title: "用户服务协议",
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/termsOfService",
      name: "termsOfService",
      component: () => import("@/pages/other/termsOfService.vue")
    },
    {
      meta: {
        title: "掌上精选APP下载-直播&短视频&达人",
        alone:true, //是否为单独访问页面（不需要验证是否登录）
      },
      path: "/download",
      name: "download",
      component: () => import("@/pages/other/download.vue")
    },
    // 推广落地页
    // {
    //   meta: {
    //     title: "找达人、寻商品、查数据  来掌上精选",
    //     alone:true, //是否为单独访问页面（不需要验证是否登录）
    //   },
    //   path: "/promote",
    //   name: "promote",
    //   component: () => import("@/pages/other/promote.vue")
    // },
    // 获取会员
    // 添加收录
    {
      meta: {
        title: "添加收录"
      },
      path: "/addIndexed",
      name: "addIndexed",
      component: () => import("@/pages/search/addIndexed.vue")
    },
    // 购买续费
    {
      meta: {
        title: "购买续费"
      },
      path: "/buyVip",
      name: "buyVip",
      component: () => import("@/pages/vip/buyVip.vue")
    },
    // 卡券包
    {
      meta: {
        title: "卡券包"
      },
      path: "/cardBag",
      name: "cardBag",
      component: () => import("@/pages/vip/cardBag.vue")
    },
    // 联系客服-二维码
    {
      meta: {
        title: "联系客服"
      },
      path: "/contactQR",
      name: "contactQR",
      component: () => import("@/pages/vip/contactQR.vue")
    },
    // 首页常用管理
    {
      meta: {
        title: "首页常用管理"
      },
      path: "/navSettings",
      name: "navSettings",
      component: () => import("@/pages/home/navSettings.vue")
    },
    // 更多权益
    {
      meta: {
        title: "更多权益"
      },
      path: "/moreEquity",
      name: "moreEquity",
      component: () => import("@/pages/mine/moreEquity.vue")
    },
    // 视频详情页
    {
      meta: {
        title: "视频详情页",
        isDetails: true,  //是否为详情页
      },
      path: "/videodetailsMain",
      name: "videodetailsMain",
      component: () => import("@/pages/video/videodetailsMain.vue"),
      children: [{
          path: "basicdata", //基础信息
          component: () => import("@/pages/video/basicdata.vue")
        },
        {
          path: "goodsdata", //商品分析
          component: () => import("@/pages/video/goodsdata.vue")
        },
        {
          path: "viewerdata", //观众分析
          component: () => import("@/pages/video/viewerdata.vue")
        }
      ]
    },
    {
      // videopage
      meta: {
        title: "关联视频"
      },
      path: "/videopage",
      name: "videopage",
      component: () => import("@/pages/video/videopage.vue")
    },
    {
      meta: {
        title: "品牌详情",
        isDetails: true,  //是否为详情页
        keepAlive: false // 此组件需要被缓存
      },
      path: "/brandRank",
      name: "brandRank",
      component: () => import("@/pages/brandDetails/brandRank.vue")
    },
    {
      // videopage
      meta: {
        title: "小店详情",
        isDetails: true,  //是否为详情页
      },
      path: "/shop_details",
      name: "shop_details",
      component: () => import("@/pages/goods/shopDetails/shop_details.vue")
    },
    {
      meta: {
        title: "音乐详情",
        isDetails: true,  //是否为详情页
        keepAlive: false // 此组件需要被缓存
      },
      path: "/musicDetails",
      name: "musicDetails",
      component: () => import("@/pages/musicDetails/musicDetails.vue")
    },
    {
      meta: {
        title: "话题详情",
        isDetails: true,  //是否为详情页
        keepAlive: false // 此组件需要被缓存
      },
      path: "/topicDetails",
      name: "topicDetails",
      component: () => import("@/pages/topicDetails/topicDetails.vue")
    },
    {
      meta: {
        title: "热门榜单",
        // type:"/"
        keepAlive: true // 此组件需要被缓存
      },
      path: "/hotRank",
      name: "hotRank",
      component: () => import("@/pages/hotRank/index.vue")
    },
  ],
  scrollBehavior(to, from, saveTop) {
    if (saveTop) {
      return saveTop;
    } else {
      return {
        x: 0,
        y: 0
      };
    }
  },
  mode: "history"
});
// 解决在目录中重复点击当前路由报错
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
